<template>
  <div style="padding: 10px">
    <el-form :inline="true" :model="params" class="demo-form-inline">
        <el-row>
            <el-form-item>
                <el-select v-model="params.net" placeholder="选择网络">
                    <el-option
                        v-for="item in options"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value"
                    >
                    </el-option>
                </el-select>
            </el-form-item>
            <el-form-item>
                <el-input v-model="params.name" placeholder="合约名称"></el-input>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="query">查询</el-button>
                <el-button type="primary" @click="reset">重置</el-button>
            </el-form-item>
        </el-row>
      </el-form>
       <el-table
      :data="tableData"
      style="width: 100%" border>
      <el-table-column
        prop="uname"
        label="合约名称"
        min-width="180">
      </el-table-column>
      <el-table-column
        prop="url"
        label="路径"
        min-width="180">
      </el-table-column>
      <el-table-column
        prop="num"
        label="交易数量">
      </el-table-column>
      <el-table-column
        prop="version"
        label="版本">
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
const dataResource = [{
    uname: '合约02',
    url: 'itms/linkage/moudle/dao',
    num: '65',
    version: '1.2.5',
}, {
    uname: '合约04',
    url: 'itms/linkage/moudle/dao',
    num: '24',
    version: '1.2.5',
}, {
    uname: '合约01',
    url: 'itms/linkage/moudle/dao',
    num: '243',
    version: '1.2.5',
}, {
    uname: '合约01',
    url: 'itms/linkage/moudle/dao',
    num: '243',
    version: '1.2.5',
}, {
    uname: '合约01',
    url: 'itms/linkage/moudle/dao',
    num: '243',
    version: '1.2.5',
}, {
    uname: '合约01',
    url: 'itms/linkage/moudle/dao',
    num: '243',
    version: '1.2.5',
}, {
    uname: '合约01',
    url: 'itms/linkage/moudle/dao',
    num: '243',
    version: '1.2.5',
}, {
    uname: '合约03',
    url: 'itms/linkage/moudle/dao',
    num: '76',
    version: '1.2.5',
}]
export default {
    name: 't4',
    data() {
        return {
            params: {},
            options: [
                {
                    value: '选项1',
                    label: '网络1',
                },
                {
                    value: '选项2',
                    label: '网络2',
                },
                {
                    value: '选项3',
                    label: '网络3',
                },
                {
                    value: '选项4',
                    label: '网络4',
                },
                {
                    value: '选项5',
                    label: '网络5',
                },
            ],
            tableData: [],
            tableData1: [],
        }
    },
    mounted() {
        this.query()
    },
    methods: {
        query() {
            let s = [{ name: '小孙', age: 1 }]


            if (this.params.name) {
                const obj = JSON.parse(JSON.stringify(dataResource))
                this.tableData = obj.filter(item => item.uname == this.params.name)
            } else {
                this.tableData = JSON.parse(JSON.stringify(dataResource))
            }
        },
        reset() {
            this.params.name = ''
            this.query()
        },
    },
}
</script>

<style scoped>
</style>